﻿using DBAccessLibrary.Model;

namespace DBAccessLibrary.Common
{
    public static class DbTypeConvert
    {
        public static string GetType(DBType fromtype, DBType totype, string type, string length)
        {
            string newtype = type;
            int fieldLength;
            int.TryParse(length, out fieldLength);
            type = type.ToUpper();
            switch (fromtype)
            {
                case DBType.DB2:
                    if (type == "NUMBER")
                    {
                        newtype = fieldLength > 9 ? "DECIMAL" : "INTEGER";
                    }
                    break;
                case DBType.Oracle:
                    break;
                case DBType.SqlServer:
                    break;
            }
            return newtype;
        }
    }
}
